import { Button } from "antd"
import { login, getPremissionRoutes } from '@/store/modules/userStore'
import { useDispatch, useSelector } from "react-redux"
import { useNavigate } from "react-router-dom"

const LoginPage: React.FC = () => {
    const dispatch: AppDispatch = useDispatch()
    const Nav = useNavigate()
    const { TOKEN } = useSelector((state: RootState) => state.user)
    const loginHandle = async () => {
        await dispatch(login())
        await dispatch(getPremissionRoutes())
        Nav('/')
    }

    return (<>
        <span>登录页面</span>
        <p>token{TOKEN}</p>
        <Button type="primary" onClick={loginHandle}>登录</Button>

    </>)
}
export default LoginPage